import request from '@/utils/request'

/**
 * 
 * @param {测试任务接口} data 
 * @returns 
 */

//测试任务分页查询
export const getList = (data) => {
  return request({
    url: '/task-runner/selectByCondition?currentPage=' + data.currentPage + '&size=' + data.size + '&taskName=' + data.taskName + '&taskStatus=' + data.taskStatus,
    method: 'get'
  })
}

//新增测试任务
export const insertTask = (data) => {
  return request({
    url: '/task-runner/insert',
    method: 'post',
    data
  })
}

//回显算法模型选中列
export const selectByIds = (data) => {
  return request({
    url: '/algor-model/selectByIds?ids=' + data,
    method: 'get'
  })
}


//查询测试任务详情
export const selectOne = (data) => {
  return request({
    url: '/task-runner/selectOne?id=' + data.id,
    method: 'get',
  })
}

//编辑算法模型数据
export const updateTask = (data) => {
  return request({
    url: '/task-runner/updateByCondition',
    method: 'post',
    data
  })
}

//批量删除测试任务
export const delateTask = (data) => {
  return request({
    url: '/task-runner/batchDelete',
    method: 'post',
    data
  })
}



/**
 * 
 * @param {数据实时监控接口} data 
 * @returns 
 */

//监控可视化数据列表
export const selectVisual = (data) => {
  return request({
    url: '/visual-data-detail/selectVisualDetailList?taskId=' + data.taskId + '&algorId=' + data.algorId + '&id=' + data.id,
    method: 'get',
  })
}

//监控原始数据列表
export const selectOriginal = (data) => {
  return request({
    url: '/visual-data-detail/selectOriginalDetailList?taskId=' + data.taskId + '&algorId=' + data.algorId + '&id=' + data.id,
    method: 'get',
  })
}

//监控日志管理列表
export const selectError = (data) => {
  return request({
    url: '/visual-data-detail/selectErrorLogInfoList?taskId=' + data.taskId + '&algorId=' + data.algorId + '&id=' + data.id,
    method: 'get',
  })
}

//新增查询原始数据名称重命名效验
export const insertRules = (data) => {
  return request({
    url: '/task-runner/existsTaskName?taskName=' + data,
    method: 'get',
  })
}

//查询任务状态
export const selectSus = (data) => {
  return request({
    url: '/task-runner/isSuspend?id=' + data,
    method: 'get',
  })
}

//暂停任务
export const pauseTask = (data) => {
  return request({
    url: '/task-runner/suspendExecuteTask?id=' + data,
    method: 'get',
  })
}

//开始任务
export const startTask = (data) => {
  return request({
    url: '/task-runner/startExecuteTask?id=' + data,
    method: 'get',
  })
}


//开始任务
export const exportTxt = (data) => {
  return request({
    url: '/error-log-info/exportDataToTxt',
    method: 'post',
    data
  })
}

